/**
 *PopupMenu.java
 *@anthor Daniel Liu
 *2006-4-25 21:46:22
 **/
package org.lex.utils.logging.handler;

import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

class DefaultPopupMenu extends JPopupMenu {
	private JCheckBoxMenuItem hideBorderCheckBoxMenuItem = null;
	private JCheckBoxMenuItem onTopCheckBoxMenuItem = null;
	private JMenuItem exitMenuItem = null;

	private LoggerMainFrame frame = null;

	DefaultPopupMenu(LoggerMainFrame frame) {
		super();
		this.frame = frame;
		this.add(getHideTitleCheckBoxMenuItem());
		this.add(getOnTopCheckBoxMenuItem());
		this.addSeparator();
		this.add(getExitMenuItem());
	}

	private JCheckBoxMenuItem getOnTopCheckBoxMenuItem() {
		if (onTopCheckBoxMenuItem == null) {
			onTopCheckBoxMenuItem = new JCheckBoxMenuItem(frame.getAlwaysOnTopAction());
		}
		return onTopCheckBoxMenuItem;
	}

	private JCheckBoxMenuItem getHideTitleCheckBoxMenuItem() {
		if (hideBorderCheckBoxMenuItem == null) {
			hideBorderCheckBoxMenuItem = new JCheckBoxMenuItem(frame.getHideBorderAction());
		}
		return hideBorderCheckBoxMenuItem;
	}

	private JMenuItem getExitMenuItem() {
		if (null == exitMenuItem) {
			exitMenuItem = new JMenuItem(frame.getExitAction());
		}
		return exitMenuItem;
	}
}
